﻿@model IEnumerable<MvcApplication2.Models.Exercise>
@{
    ViewBag.Title = "Index";
}
<h2>
    Index</h2>
<p>
    @Html.ActionLink("Create New", "CreateExercises", "Developer", null,new { @class = "btn btn-large btn-primary" })
</p>
<table class="table table-striped">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Status)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Title)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Device)
        </th>
        <th>
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Status)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Title)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Device.Description)
            </td>
            <td>
                @if (item.Status == "published")
                {
                    @Html.ActionLink("Find Testers", "FindTesters", new { id = item.ExerciseId }, new { @class = "btn btn-primary btn-mini" })
                }
            </td>
            <td>
                @Html.ActionLink("Edit", "EditExercise",  new { id = item.ExerciseId }, new { @class = "btn btn-mini" })
                @Html.ActionLink("Details", "Details", new { id = item.ExerciseId }, new { @class = "btn btn-mini" })
                @Html.ActionLink("Delete", "DeleteExercise", new { id = item.ExerciseId }, new { @class = "btn btn-warning btn-mini" })

            </td>
        </tr>
    }
</table>
